const mysql = require("mysql")

let con = mysql.createConnection({
    port: '3306',
    host: "localhost",
    user: "admin",
    password: "123456",
    database: "home"
})
con.connect()
function query(sql) {
    return new Promise((resolve, reject) => {
        con.query(sql, (err, data) => {
            if (err) reject(err)
            if (data) resolve(data)
        })
    })
}

module.exports = query